import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, IsArray } from 'class-validator';
import { Type } from 'class-transformer';

export class CreateUserDto {
  @ApiProperty({
    description: 'The username of the user',
  })
  @IsNotEmpty({ message: 'username is required' })
  @IsString({ message: 'username should be a string' })
  username: string;

  @ApiProperty({
    description: 'The password of the user',
  })
  @IsNotEmpty({ message: 'Password is required' })
  @IsString({ message: 'Password should be a string' })
  password: string;

  @ApiProperty({
    description: 'The email of the user',
  })
  @IsNotEmpty({ message: 'Email is required' })
  @IsArray({
    message: 'Email should be an array',
  })
  @Type(() => Number)
  roleIds: number[];
  @ApiProperty({
    description: 'The first name of the user',
  })
  @IsNotEmpty({ message: 'First name is required' })
  @IsString({ message: 'First name should be a string' })
  nickname: string;
}
